package com.lhkj.ct.meta.modules.patient.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lhkj.ct.base.model.Option;
import com.lhkj.ct.base.model.dto.PageQuery;
import com.lhkj.ct.base.mybatis.extension.service.impl.IServiceImpl;
import com.lhkj.ct.meta.modules.patient.mapper.PatCrowdTagMapper;
import com.lhkj.ct.meta.modules.patient.model.entity.TblPatCrowdTag;
import com.lhkj.ct.meta.modules.patient.service.PatCrowdTagService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 档案人群标签 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2023-09-25
 */
@Service
public class PatCrowdTagServiceImpl extends IServiceImpl<PatCrowdTagMapper, TblPatCrowdTag> implements PatCrowdTagService {

    @Override
    public IPage<TblPatCrowdTag> selectCrowdTagPage(TblPatCrowdTag queryParams, PageQuery pageQuery) {
        return getBaseMapper().selectCrowdTagPage(generatePageDesc(pageQuery,
                TblPatCrowdTag::getCreateTime), queryParams, pageQuery);
    }

    @Override
    public int insert(TblPatCrowdTag entity) {
        if (null == entity.getSort()){
            entity.setSort(getBaseMapper().selectMaxSort());
        }
        return getBaseMapper().insert(entity);
    }

    @Override
    public List<Option<String>> listOptions() {
        return getBaseMapper().listOptions();
    }
}
